package com.chucknorris.android.util;

import java.util.Locale;

import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;

public class LocaleUtils {

	public static String getCurrentLocale() {
		return Locale.getDefault().getLanguage();
	}

	public static void changeLocale(Context context, String newLocale) {
		String languageToLoad = newLocale;
		Locale locale = new Locale(languageToLoad);
		Locale.setDefault(locale);
		Configuration config = new Configuration();
		config.locale = locale;
		((Activity) context).getBaseContext().getResources()
				.updateConfiguration(config, ((Activity) context).getBaseContext().getResources().getDisplayMetrics());
	}

}
